import { Component } from 'vue-property-decorator';

import { EnumFieldOption, EnumField } from '../../vendors/handie/types/input';

import { resolveEnumOptions } from '../helper';
import FilterHeadlessWidget from './Filter';

@Component
export default class BaseEnumFilterHeadlessWidget<
  ValueType
> extends FilterHeadlessWidget<ValueType> {
  protected options: EnumFieldOption[] = [];

  protected created(): void {
    resolveEnumOptions(
      this.viewContext,
      this.filter as EnumField,
      options => (this.options = options),
    );
  }
}
